package com.itzhoun.sort;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zhounan
 * @Title: design-patterns
 * @Description: TODO
 * @date 30/7/2023下午 9:35
 */
public class Client {

    public static void main(String[] args) {

        AgeSortStrategy ageSortStrategy = new AgeSortStrategy();

        List<Person> personList = new ArrayList<>();

        Person person =  new Person();
        person.setId(1);
        person.setAge(22);
        person.setName("周楠22");
        personList.add(person);

        Person person1 =  new Person();
        person1.setId(2);
        person1.setAge(23);
        person1.setName("周楠22");
        personList.add(person1);

        Environment environment = new Environment(ageSortStrategy, "DESC");
        environment.sort(personList);

        for (Person person2 : personList) {

            System.out.println(person2);
        }


    }
}
